import axios from "axios";
import baseConfig from "../config";

const nav = {
  getList: function () {
    return axios
      .get(
        baseConfig.url + "&a=category", {
          params: {}
        }
      )
      .then(res => {
        return res.data;
      });

  }
}
const content = {
  getList: function (catid, pagesize, page) {
    return axios
      .get(
        baseConfig.url + "&a=Artilce", {
          params: {
            catid: catid,
            page: page ? page : 0,
            pagesize: pagesize
          }
        }
      )
      .then(res => {
        return res.data;
      });
  },
  getDetail: function (id) {
    return axios
      .get(
        baseConfig.url + "&a=Artilce", {
          params: {
            id: id
          }
        }
      )
      .then(res => {
        return res.data[0];
      });
  }
};

export {
  nav,
  content
};
